<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<a href="xixi.html">xixi</a>
<script>



//    xml -  JSON
var person = [{
        name:'zhangsan',
        age:45,
        sex:'男'
    },{
        name:'zhangsan1',
        age:23,
        sex:'女'
    },{
        name:'zhangsan2',
        age:2,
        sex:'男'
    },{
        name:'zhangsan3',
        age:45,
        sex:'女'
    },{
        name:'zhangsan4',
        age:188,
        sex:'女'
    },{
        name:'zhangsan5',
        age:23,
        sex:'男'
    },];

var str =`[{
  "name":"张三",
  "age":18,
  "man":true
},{
  "name":"张三",
  "age":18,
  "man":true
}]`;

//sessionStorage.clear()  清除所有
//sessionStorage.getItem('key') 获取值
//sessionStorage.removeItem('key') 删除一项
//sessionStorage.setItem('age',18); 设置一项

sessionStorage.setItem('persons',JSON.stringify(person));
//序列化-->JSON.stringify(person)
//反序列化-->JSON.parse(str)
//    alert( JSON.stringify(person,null,4));
//    alert(JSON.parse(str)[0].name);
</script>
</body>
</html>